<!-- Main Sidebar Container -->
<aside class="main-sidebar sidebar-dark-primary elevation-4">
    <!-- Brand Logo -->
    <a href="{% url 'cms:dashboard' %}" class="brand-link">
        <img src="{% static 'images/cms_logo.png' %}" alt="Peekpa Logo"
             class="brand-image img-circle elevation-3 border"
             style="opacity: .8">
        <span class="brand-text font-weight-light"><b>Peekpa</b>控制台</span>
    </a>

    <!-- Sidebar -->
    <div class="sidebar">
        <!-- Sidebar Menu -->
        <nav class="mt-2">
            <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu"
                data-accordion="false">
                <!-- Add icons to the links using the .nav-icon class
                     with font-awesome or any other icon font library -->
                {% url 'cms:dashboard' as cms_home_page %}
                <li class="nav-item">
                    <a href="{{ cms_home_page }}" class="nav-link {% if request.path == cms_home_page %}active{% endif %}">
                        <i class="nav-icon fas fa-tachometer-alt"></i>
                        <p>
                            Home
                        </p>
                    </a>
                </li>
                {% url 'cms:feature_manage_view' as feature_manage_view %}
                {% url 'cms:feature_publish_view' as feature_publish_view %}
                <li class="nav-item has-treeview {% if request.path == feature_manage_view or request.path == feature_publish_view %}menu-open{% endif %}">
                    <a href="#" class="nav-link {% if request.path == feature_manage_view or request.path == feature_publish_view %}active{% endif %}">
                      <i class="nav-icon fas fa-glass-cheers"></i>
                      <p>
                        Feature News
                        <i class="right fas fa-angle-left"></i>
                      </p>
                    </a>
                    <ul class="nav nav-treeview">
                      <li class="nav-item">
                        <a href="{% url 'cms:feature_manage_view' %}" class="nav-link {% if request.path == feature_manage_view %}active{% endif %}">
                          <i class="far fa-circle nav-icon"></i>
                          <p>Management</p>
                        </a>
                      </li>
                      <li class="nav-item">
                        <a href="{% url 'cms:feature_publish_view' %}" class="nav-link {% if request.path == feature_publish_view %}active{% endif %}">
                          <i class="far fa-circle nav-icon"></i>
                          <p>Publish</p>
                        </a>
                      </li>
                    </ul>
                </li>
                {% url 'cms:post_manage_view' as post_manage_view %}
                {% url 'cms:post_publish_view' as post_publish_view %}
                <li class="nav-item has-treeview {% if request.path == post_manage_view or request.path == post_publish_view %}menu-open{% endif %}">
                    <a href="{{ post_manage_view }}" class="nav-link {% if request.path == post_manage_view or request.path == post_publish_view %}active{% endif %}">
                      <i class="nav-icon far fa-copy"></i>
                      <p>
                        Post
                        <i class="right fas fa-angle-left"></i>
                      </p>
                    </a>
                    <ul class="nav nav-treeview">
                      <li class="nav-item">
                        <a href="{{ post_manage_view }}" class="nav-link {% if request.path == post_manage_view %}active{% endif %}">
                          <i class="far fa-circle nav-icon"></i>
                          <p>Management</p>
                        </a>
                      </li>
                      <li class="nav-item">
                        <a href="{{ post_publish_view }}" class="nav-link {% if request.path == post_publish_view %}active{% endif %}">
                          <i class="far fa-circle nav-icon"></i>
                          <p>Publish</p>
                        </a>
                      </li>
                    </ul>
                </li>
                {% url 'cms:category_manage_view' as category_manage_view %}
                {% url 'cms:category_publish_view' as category_publish_view %}
                <li class="nav-item has-treeview {% if request.path == category_manage_view or request.path == category_publish_view %}menu-open{% endif %}">
                    <a href="#" class="nav-link {% if request.path == category_manage_view or request.path == category_publish_view %}active{% endif %}">
                      <i class="nav-icon far fa-bookmark"></i>
                      <p>
                        Category
                        <i class="right fas fa-angle-left"></i>
                      </p>
                    </a>
                    <ul class="nav nav-treeview">
                      <li class="nav-item">
                        <a href="{{ category_manage_view }}" class="nav-link {% if request.path == category_manage_view %}active{% endif %}">
                          <i class="far fa-circle nav-icon"></i>
                          <p>Management</p>
                        </a>
                      </li>
                      <li class="nav-item">
                        <a href="{{ category_publish_view }}" class="nav-link {% if request.path == category_publish_view %}active{% endif %}">
                          <i class="far fa-circle nav-icon"></i>
                          <p>Publish</p>
                        </a>
                      </li>
                    </ul>
                </li>
                {% url 'cms:tag_manage_view' as tag_manage_view %}
                {% url 'cms:tag_publish_view' as tag_publish_view %}
                <li class="nav-item has-treeview {% if request.path == tag_manage_view or request.path == tag_publish_view %}menu-open{% endif %}">
                    <a href="#" class="nav-link {% if request.path == tag_manage_view or request.path == tag_publish_view %}active{% endif %}">
                      <i class="nav-icon fas fa-tags"></i>
                      <p>
                        Tag
                        <i class="right fas fa-angle-left"></i>
                      </p>
                    </a>
                    <ul class="nav nav-treeview">
                      <li class="nav-item">
                        <a href="{% url 'cms:tag_manage_view' %}" class="nav-link {% if request.path == tag_manage_view %}active{% endif %}">
                          <i class="far fa-circle nav-icon"></i>
                          <p>Management</p>
                        </a>
                      </li>
                      <li class="nav-item">
                        <a href="{% url 'cms:tag_publish_view' %}" class="nav-link {% if request.path == tag_publish_view %}active{% endif %}">
                          <i class="far fa-circle nav-icon"></i>
                          <p>Publish</p>
                        </a>
                      </li>
                    </ul>
                </li>
                {% url 'cms:exchangelink_manage_view' as exchangelink_manage_view %}
                {% url 'cms:exchangelink_publish_view' as exchangelink_publish_view %}
                <li class="nav-item has-treeview {% if request.path == exchangelink_manage_view or request.path == exchangelink_publish_view %}menu-open{% endif %}">
                    <a href="#" class="nav-link {% if request.path == exchangelink_manage_view or request.path == exchangelink_publish_view %}active{% endif %}">
                      <i class="nav-icon fas fa-link"></i>
                      <p>
                        ExchangeLink
                        <i class="right fas fa-angle-left"></i>
                      </p>
                    </a>
                    <ul class="nav nav-treeview">
                      <li class="nav-item">
                        <a href="{% url 'cms:exchangelink_manage_view' %}" class="nav-link {% if request.path == exchangelink_manage_view %}active{% endif %}">
                          <i class="far fa-circle nav-icon"></i>
                          <p>Management</p>
                        </a>
                      </li>
                      <li class="nav-item">
                        <a href="{% url 'cms:exchangelink_publish_view' %}" class="nav-link {% if request.path == exchangelink_publish_view %}active{% endif %}">
                          <i class="far fa-circle nav-icon"></i>
                          <p>Publish</p>
                        </a>
                      </li>
                    </ul>
                </li>
                {% url 'cms:navitem_manage_view' as navitem_manage_view %}
                {% url 'cms:navitem_publish_view' as navitem_publish_view %}
                <li class="nav-item has-treeview {% if request.path == navitem_manage_view or request.path == navitem_publish_view %}menu-open{% endif %}">
                    <a href="#" class="nav-link {% if request.path == navitem_manage_view or request.path == navitem_publish_view %}active{% endif %}">
                      <i class="nav-icon far fa-compass"></i>
                      <p>
                        Navbar Item
                        <i class="right fas fa-angle-left"></i>
                      </p>
                    </a>
                    <ul class="nav nav-treeview">
                      <li class="nav-item">
                        <a href="{% url 'cms:navitem_manage_view' %}" class="nav-link {% if request.path == navitem_manage_view %}active{% endif %}">
                          <i class="far fa-circle nav-icon"></i>
                          <p>Management</p>
                        </a>
                      </li>
                      <li class="nav-item">
                        <a href="{% url 'cms:navitem_publish_view' %}" class="nav-link {% if request.path == navitem_publish_view %}active{% endif %}">
                          <i class="far fa-circle nav-icon"></i>
                          <p>Publish</p>
                        </a>
                      </li>
                    </ul>
                </li>
                {% if request.user.is_superuser %}
                    {% url 'cms:code_manage_view' as code_manage_view %}
                    {% url 'cms:code_publish_view' as code_publish_view %}
                    <li class="nav-item has-treeview {% if request.path == code_manage_view or request.path == code_publish_view %}menu-open{% endif %}">
                        <a href="#" class="nav-link {% if request.path == code_manage_view or request.path == code_publish_view %}active{% endif %}">
                          <i class="nav-icon fas fa-code"></i>
                          <p>
                            Code
                            <i class="right fas fa-angle-left"></i>
                          </p>
                        </a>
                        <ul class="nav nav-treeview">
                          <li class="nav-item">
                            <a href="{% url 'cms:code_manage_view' %}" class="nav-link {% if request.path == code_manage_view %}active{% endif %}">
                              <i class="far fa-circle nav-icon"></i>
                              <p>Management</p>
                            </a>
                          </li>
                          <li class="nav-item">
                            <a href="{% url 'cms:code_publish_view' %}" class="nav-link {% if request.path == code_publish_view %}active{% endif %}">
                              <i class="far fa-circle nav-icon"></i>
                              <p>Publish</p>
                            </a>
                          </li>
                        </ul>
                    </li>
                    {% url 'cms:data_center_inputcode_manage_view' as data_center_inputcode_manage_view %}
                    <li class="nav-item has-treeview {% if request.path == data_center_inputcode_manage_view %}menu-open{% endif %}">
                        <a href="#" class="nav-link {% if request.path == data_center_inputcode_manage_view %}active{% endif %}">
                          <i class="nav-icon fas fa-database"></i>
                          <p>
                            DataCenter
                            <i class="right fas fa-angle-left"></i>
                          </p>
                        </a>
                        <ul class="nav nav-treeview">
                          <li class="nav-item">
                            <a href="{% url 'cms:data_center_inputcode_manage_view' %}" class="nav-link {% if request.path == data_center_inputcode_manage_view %}active{% endif %}">
                              <i class="fas fa-terminal nav-icon"></i>
                              <p>Input Code Management</p>
                            </a>
                          </li>
                        </ul>
                    </li>
                    {% url 'cms:user_manage_view' as user_manage_view %}
                    {% url 'cms:user_publish_view' as user_publish_view %}
                    <li class="nav-item has-treeview {% if request.path == user_manage_view or request.path == user_publish_view %}menu-open{% endif %}">
                        <a href="#" class="nav-link {% if request.path == user_manage_view or request.path == user_publish_view %}active{% endif %}">
                          <i class="nav-icon fas fa-user"></i>
                          <p>
                            User
                            <i class="right fas fa-angle-left"></i>
                          </p>
                        </a>
                        <ul class="nav nav-treeview">
                          <li class="nav-item">
                            <a href="{% url 'cms:user_manage_view' %}" class="nav-link {% if request.path == user_manage_view %}active{% endif %}">
                              <i class="far fa-circle nav-icon"></i>
                              <p>Management</p>
                            </a>
                          </li>
                          <li class="nav-item">
                            <a href="{% url 'cms:user_publish_view' %}" class="nav-link {% if request.path == user_publish_view %}active{% endif %}">
                              <i class="far fa-circle nav-icon"></i>
                              <p>Publish</p>
                            </a>
                          </li>
                        </ul>
                    </li>
                {% endif %}

                {% url 'cms:monitor_userip_view' as monitor_userip_view%}
                {% url 'cms:monitor_postview_view' as monitor_postview_view %}
                <li class="nav-item has-treeview {% if request.path == monitor_userip_view or request.path == monitor_postview_view %}menu-open{% endif %}">
                    <a href="#" class="nav-link {% if request.path == monitor_userip_view or request.path == monitor_postview_view %}active{% endif %}">
                      <i class="nav-icon fas fa-desktop"></i>
                      <p>
                        Monitor
                        <i class="right fas fa-angle-left"></i>
                      </p>
                    </a>
                    <ul class="nav nav-treeview">
                      <li class="nav-item">
                        <a href="{% url 'cms:monitor_userip_view' %}" class="nav-link {% if request.path == monitor_userip_view %}active{% endif %}">
                          <i class="far fa-address-book nav-icon"></i>
                          <p>User IP</p>
                        </a>
                      </li>
                      <li class="nav-item">
                        <a href="{% url 'cms:monitor_postview_view' %}" class="nav-link {% if request.path == monitor_postview_view %}active{% endif %}">
                          <i class="fas fa-eye nav-icon"></i>
                          <p>Post View</p>
                        </a>
                      </li>
                    </ul>
                </li>

                {% url 'cms:cache_manage_view' as cache_manage_view %}
                <li class="nav-item has-treeview {% if request.path == cache_manage_view %}menu-open{% endif %}">
                    <a href="#"
                       class="nav-link {% if request.path == cache_manage_view %}active{% endif %}">
                        <i class="nav-icon fas fa-money-bill-alt"></i>
                        <p>
                            Website Cache
                            <i class="right fas fa-angle-left"></i>
                        </p>
                    </a>
                    <ul class="nav nav-treeview">
                        <li class="nav-item">
                            <a href="{% url 'cms:cache_manage_view' %}"
                               class="nav-link {% if request.path == cache_manage_view %}active{% endif %}">
                                <i class="fas fa-donate nav-icon"></i>
                                <p>Cache Management</p>
                            </a>
                        </li>
                    </ul>
                </li>
            </ul>
        </nav>
        <!-- /.sidebar-menu -->
        {% if peekpa_version %}
            <small class="ml-4 text-light">Version: {{ peekpa_version }}</small>
        {% endif %}
    </div>
    <!-- /.sidebar -->
</aside>